package com.greateamd.timetableasy.server.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import org.hibernate.HibernateException;
import org.springframework.security.access.prepost.PreAuthorize;

import com.greateamd.timetableasy.domain.Room;
import com.greateamd.timetableasy.domain.exceptions.DBServerSideException;
import com.greateamd.timetableasy.domain.exceptions.IllegalEntityStateException;


public interface RoomDAO extends IBaseDao<Room, Integer> {

	@Override @PreAuthorize("hasRole('ROLE_ADMIN')")
	void save(Room room) throws IllegalEntityStateException,HibernateException,SQLException;
	
	@Override @PreAuthorize("hasRole('ROLE_ADMIN')")
	void update(Room obj)throws HibernateException,SQLException,IllegalAccessException;
	
	@Override @PreAuthorize("hasRole('ROLE_ADMIN')")
	void delete(Room obj)throws HibernateException,SQLException,IllegalAccessException;
	
	boolean getDisponibility(Integer excluseThisEventId,String room,Date from,int duration)throws HibernateException,SQLException;
	
	@PreAuthorize("isAuthenticated()")
	List<Room> getAllOfLoggedUser() throws DBServerSideException, HibernateException, SQLException;
}
